﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>上传列表</title>
    <link href="${pageContext.request.contextPath}/css/themes/default/easyui.css" rel="stylesheet" />
	<link href="${pageContext.request.contextPath}/css/themes/icon.css" rel="stylesheet"></link>
    <link href="${pageContext.request.contextPath}/css/themes/color.css" rel="stylesheet" />
    <script src="${pageContext.request.contextPath}/script/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/script/jquery.easyui.min.js"></script>
    <script src="${pageContext.request.contextPath}/script/wen.js"></script>
    <script src="${pageContext.request.contextPath}/script/easyui-lang-zh_CN.js"></script>
    <style>
        body {
            font-size: 12px;
            overflow-y: hidden;
        }
         th {
         	font-size: 20px;
         } 
         td {
         	font-size: 18px;
         }  
         .datagrid-header .datagrid-cell span {
		    font-size: 15px;
    		font-weight: 800;
		}
		.datagrid-cell{
   			 font-size: 18px;
   			 font-weight: 300;
		}

    </style>
</head>
<body class="easyui-layout" onload="initContent()">
<div data-options="region:'center'">
<div class="easyui-tabs" data-options="fit:true">
<div title="上传列表" style="padding:10px;">
	
      <table class="easyui-datagrid" style="width:auto; height: 100%; padding:5px" id="table">
    		<!-- <thead>
    		<tr>
				<th data-options="field:'id'" width="6%" align="center">ID</th>
				<th data-options="field:'scmc'" width="20%" align="center">上传名称</th>
				<th data-options="field:'scdz'" width="35%" align="center">上传地址</th>
				<th data-options="field:'classify'" width="12%" align="center">上传类型</th>
				<th data-options="field:'scsj'" width="20%" align="center">上传时间</th>
				<th data-options="field:'cz'" width="6%" align="center">操作</th>
			</tr>
			</thead> -->
    </table> 
</div>
</div>
</div>

 <script>
 	function del(id){
		$.get("${pageContext.request.contextPath}/upload/deleteupload?id=" + id,function(data){
			if("success" == data.result){
				alert("删除失败");
			}else{
				alert("删除成功");
				window.location.reload();
				//$('#table').datagrid('load');
			}
		});
	}
 

    	/* $(function(){
    		$.ajax({
    			url:"${pageContext.request.contextPath}/upload/listupload",
    			type:"GET",
    			dataType:"json",
    			success:function(data){
    			//alert("ok");
    			for(var i = 0;i<data.length;i++){
  					var obj=data[i];
  					var id=obj.id;
  					var scmc=obj.scmc;
  					var scdz='<a href="'+obj.scdz+'">' + obj.scdz + '</a>';	//替换obj.scdz   '<img src="'+obj.scdz+'" style="width: 100px;height:60px;"/>'
  					var classify=obj.classify.classify;
  					var scsj=obj.scsj;
  					var cz='<a href="javascript:del('+data[i].id+')">'+'<img src="${pageContext.request.contextPath}/images/del.png"/>'+'</a>';	
  					$("#table").datagrid("appendRow",{
  						"id":id,
  						"scmc":scmc,
  						"scdz":scdz,
  						"classify":classify,
  						"scsj":scsj,
  						"cz":cz	
  					});
    			}		
    			},
    			error:function(){
    				alert("error");
    			}
    		});
    	}); */
    	
    	
    	 $(function(){
    $('#table').datagrid({
        url:"${pageContext.request.contextPath}/upload/listuploads",
       /*  
        singleSelect:true,
        pagination:true,
        idField:'id',
        fitColumns:true,
        fit:true,
        nowarp:false,
        border:false, */
        rownumbers:true,
        singleSelect:true,
        idField:'id',
        fitColumns : true,
		singleSelect : true,
		rownumbers : true,
		pagination : true,
        pageSize:5,
        pageList:[5,10,15],
        columns:[[  
            {field:'id',title:'ID',width:'6%',align:'center'},
            {field:'scmc',title:'上传名称',width:'20%',align:'center'},
            {field:'scdz',title:'上传地址',width:'35%',align:'center'},
            {field:'classname',title:'上传类型',width:'12%',align:'center'},
            {field:'scsj',title:'上传时间',width:'20%',align:'center'},
            {field:'cz',title:'操作',width:'6%',align:'center',
            formatter : function(value, row, index) {
				  var cz ='<a href="'+row.scdz+'" name="opera" class="easyui-linkbutton" ><img src="${pageContext.request.contextPath}/images/xz.png" class="masterTooltip" title="点击下载"/></a>'
				  		  +'||'+
				  		  '<a href="javascript:del('+row.id+')" name="opera" class="easyui-linkbutton" ><img src="${pageContext.request.contextPath}/images/del.png" class="masterTooltip" title="点击删除"/></a>'; 
				return cz;
			}
            },
        ]]
    });
}); 
    </script>
</body>
</html>